using namespace std;
#include<unistd.h>
#include<signal.h>
#include<iostream>
void handler(int sig)
{
    cout<<"get sig:"<<sig<<endl;
    exit(1);
}
int main()
{
    pid_t id = fork();
    if(id==0)
    {
        signal(2,handler);
        while(true)
        {
            cout<<"I am child process"<<endl;
            sleep(1);
        }
    }
    sleep(4);
    kill(id,2);
    return 0;
}